<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>产品月销量表格</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Microsoft YaHei', Arial, sans-serif;
        }
        
        body {
            background-color: #f9f7f7;
            padding: 30px;
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh;
        }
        
        .container {
            max-width: 800px;
            width: 100%;
            background-color: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
        }
        
        h1 {
            text-align: center;
            color: #e84393;
            margin-bottom: 20px;
            font-size: 28px;
        }
        
        .description {
            text-align: center;
            color: #666;
            margin-bottom: 30px;
            line-height: 1.6;
        }
        
        .table-container {
            overflow-x: auto;
            margin-bottom: 30px;
        }
        
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 0 auto;
            font-size: 16px;
        }
        
        caption {
            font-size: 20px;
            font-weight: bold;
            color: #e84393;
            margin-bottom: 15px;
            caption-side: top;
            text-align: center;
        }
        
        th, td {
            border: 1px solid #f8a5c2;
            padding: 12px 15px;
            text-align: center;
        }
        
        th {
            background-color: #fce4ec;
            color: #c2185b;
            font-weight: 600;
        }
        
        tr:nth-child(even) {
            background-color: #fef9fb;
        }
        
        tr:hover {
            background-color: #fdeff5;
        }
        
        .total-row {
            background-color: #e3f2fd;
            font-weight: bold;
        }
        
        .total-row td:first-child {
            text-align: left;
        }
        
        .total-row td:last-child {
            text-align: right;
            color: #1565c0;
        }
        
        .code-container {
            display: flex;
            gap: 20px;
            margin-top: 30px;
            flex-wrap: wrap;
        }
        
        .code-block {
            flex: 1;
            min-width: 300px;
            background-color: #2d3748;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .code-header {
            background-color: #4a5568;
            color: white;
            padding: 10px 15px;
            font-weight: bold;
        }
        
        .code-content {
            padding: 15px;
            color: #cbd5e0;
            font-family: 'Courier New', monospace;
            white-space: pre-wrap;
            overflow-x: auto;
        }
        
        .note {
            margin-top: 20px;
            padding: 15px;
            background-color: #e3f2fd;
            border-left: 4px solid #2196f3;
            border-radius: 4px;
        }
        
        @media (max-width: 600px) {
            body {
                padding: 15px;
            }
            
            .container {
                padding: 15px;
            }
            
            th, td {
                padding: 8px 10px;
                font-size: 14px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>产品月销量表格</h1>
        <p class="description">以下是根据图片要求实现的产品月销量表格，包含HTML结构和CSS样式。</p>
        
        <div class="table-container">
            <table>
                <caption>产品月销量</caption>
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>产品名称</th>
                        <th>销量</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>2021090901</td>
                        <td>马克杯</td>
                        <td>5000</td>
                    </tr>
                    <tr>
                        <td>2021090901</td>
                        <td>啤酒杯</td>
                        <td>5200</td>
                    </tr>
                    <tr>
                        <td>2021090901</td>
                        <td>搪瓷杯</td>
                        <td>3500</td>
                    </tr>
                    <tr class="total-row">
                        <td colspan="2">合计</td>
                        <td>13700</td>
                    </tr>
                </tbody>
            </table>
        </div>
        
        <div class="code-container">
            <div class="code-block">
                <div class="code-header">HTML 代码</div>
                <div class="code-content">
&lt;table&gt;
    &lt;caption&gt;产品月销量&lt;/caption&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;ID&lt;/th&gt;
            &lt;th&gt;产品名称&lt;/th&gt;
            &lt;th&gt;销量&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;2021090901&lt;/td&gt;
            &lt;td&gt;马克杯&lt;/td&gt;
            &lt;td&gt;5000&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;2021090901&lt;/td&gt;
            &lt;td&gt;啤酒杯&lt;/td&gt;
            &lt;td&gt;5200&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;2021090901&lt;/td&gt;
            &lt;td&gt;搪瓷杯&lt;/td&gt;
            &lt;td&gt;3500&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr class="total-row"&gt;
            &lt;td colspan="2"&gt;合计&lt;/td&gt;
            &lt;td&gt;13700&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
                </div>
            </div>
            
            <div class="code-block">
                <div class="code-header">CSS 代码</div>
                <div class="code-content">
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}

caption {
    font-size: 20px;
    font-weight: bold;
    color: #e84393;
    margin-bottom: 15px;
}

th, td {
    border: 1px solid #f8a5c2;
    padding: 12px 15px;
    text-align: center;
}

th {
    background-color: #fce4ec;
    color: #c2185b;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: #fef9fb;
}

.total-row {
    background-color: #e3f2fd;
    font-weight: bold;
}

.total-row td:first-child {
    text-align: left;
}

.total-row td:last-child {
    text-align: right;
    color: #1565c0;
}
                </div>
            </div>
        </div>
        
        <div class="note">
            <strong>实现说明：</strong> 表格使用粉色细线边框，表头有浅粉色背景，数据行交替使用白色和浅粉色背景以提高可读性。最后一行"合计"使用浅蓝色背景，数字右对齐，文本左对齐，符合图片中的样式要求。
        </div>
    </div>
</body>
</html>